package com.lbs.jiepiaisi.activity;

import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.view.View;
import android.widget.ImageButton;

import com.lbs.jiepiaisi.R;
import com.lbs.jiepiaisi.base.BaseActivity;
import com.lbs.jiepiaisi.base.BaseActivityManager;
import com.lbs.jiepiaisi.base.BaseFragmentActivity;
import com.lbs.jiepiaisi.fragment.PhotoFragment;
import com.lbs.jiepiaisi.fragment.ServiceFragment;

public class VisitTypeActivity extends FragmentActivity implements View.OnClickListener{

    private ImageButton mBack;

    private int postition;
    private String eqModel;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_visit_type_zhao);
        //写死竖屏
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
        //添加当前Activity到Activity管理器
        BaseActivityManager.add(this);
        getExtras();
        findView();
        setListener();
        init();
    }
    /**
     * 获取传参
     */
    protected void getExtras() {
        postition = getIntent().getIntExtra("position",-1);
        eqModel = getIntent().getStringExtra("eqModel");
    }

    protected void findView(){
        mBack = (ImageButton)findViewById(R.id.title_but_left);
    }
    protected void setListener(){
        mBack.setOnClickListener(this);
    }

    private void init(){
        FragmentTransaction fragment = getSupportFragmentManager().beginTransaction();
        fragment.replace(R.id.fragment_container, new PhotoFragment(postition,eqModel,false));
        fragment.commit();
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.title_but_left:
                finish();
                break;
        }
    }
}
